NROFF

Section: Sept 1989 (1)
Updated: Commands Manual
Index Return to Main Contents
 

NAME

nroff - text processor

 

SYNOPSIS

nroff [options] file [...]

 

DESCRIPTION

Nroff is a text processor and formatter based on the design provided in "Software Tools" by Kernighan and Plauger. It has been modified to closely resemble the Unix(tm) nroff command. The text and commands found in the file(s) are processed to generate formatted text. Note that one (and only one) of the files can be "-" which reads input from stdin at that point. The output always goes to stdout which can be redirected by the shell. The -o option lets you redirect error output to the specified file rather than stderr. Debugging information always goes to the file "nroff.dbg" and is generally used only for program development.

 

OPTIONS

The following command line options are available:
-a            Changes font (not implemented).

-b            Allows backspaces to appear in the output
              text  when  underlining  or overstriking.
              This  has  the  same  effect  as  the .bs
              command with a non-zero argument.

-d            Set debug mode.

-h            Hold screen before desktop (TOS only).

-l            Send output to printer (not implemented).

-m<name>      Process  macro  file  tmac.<name>.   Thus
              -man would cause the file  tmac.an  to be
              loaded. Note that files processed in this
              way should contain only macro definitions,
              no  immediate output  should be generated
              from this file (see ENVIRONMENT).

-o file       Set error log file (default is stderr).

-po<n>        Shift output right n spaces (like .po).

-pn<n>        Initial page number (like .pn).

-v            Prints the version information to stdout.

+<n>          Causes output to start with page n.

-<n>          Causes output to stop after page n.

-             Input from stdin.

 

ENVIRONMENT

Nroff recognizes the following environment variables from the shell:



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
An alternate directory to find the files tmac.* ("." for example). The default is c:\lib\tmac under TOS.

 

FILES

c:\lib\tmac\tmac.*      predefined macros (see ENVIRONMENT)
nroff.dbg               debugging output
stderr                  default error output stream
stdout                  output stream

 

COMMANDS

Commands typically are distinguished by a period in column one of the input followed by a two character abbreviation for the command funtion. The abbreviation may then be followed by an optional numeric or character argument. The numeric argument may be an absolute value such as setting the right margin to a particular column, or the argument may be preceded by a plus sign or a minus sign to indicate that the parameter should be modified relative to a previous setting. The following commands are recognized (those marked "extension" are requests added to the basic set):



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes the following lines of text to appear in boldface. The optional argument specifies the number of lines to be typed in boldface. Boldface and underlining are mutually exclusive features. The appearance of a boldface command will cause any underlining to cease.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes succeeding text to appear at the top of a new page. The optional argument specifies the page number for the new page. The initial value is one and the default value is one more than the previous page number.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes succeeding text to start on a new line at the current left margin. There is no numeric argument for this command.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
enables or disables the appearance of backspaces in the output text. Underlining and boldface options are implemented by inserting character - backspace - character combinations into the output buffer. This is fine for devices which properly recognize the backspace character. Some printers, however, do not recognize backspaces, so the option is provided to overprint one line buffer with another. The first line buffer is terminated with just a carriage return rather than the carriage return - linefeed combination. A zero argument or no argument to the backspace command removes backspaces from the output. A non-zero argument leaves them in the output. The default is to remove backspaces.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
changes the nroff command character to that specified by the character argument. If no argument is provided, the default is a period.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes the next line of text to appear centered on the output. The optional argument specifies if more than one line is to be centered.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
changes the nroff no break character to that specified by the character argument. If no argument is provided, the default is a single quote.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes all text and commands following to be used to define a macro. The definition is terminated by a .en command or the default .. terminator. The first two characters of the argument following the .de command become the name of the new command. It should be noted that upper and lower case arguments are considered different. Thus, the commands .PP and .pp could define two different macros. Care should be exercised since existing commands may be redefined.

A macro may contain up to ten arguments. In the macro definition, the placement of arguments is designated by the two character sequences, $0, $1, ... $9. When the macro is invoked, each argument of the macro command line is substituted for its corresponding designator in the expansion. The first argument of the macro command is substituted for the $0 in the expansion, the second argument for the $1, and so forth. Arguments are typically strings which do not contain blanks or tabs. If an argument is to contain blanks, then it should be surrounded by either single or double quotes.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes the next line(s) of text to be continuously underlined. Unlike the underline command (see .ul) which underlines only alphanumerics, continuous underlining underlines all printable characters. The optional argument specifies the number of lines of text to underlined. Any normal underlining or boldface commands currently in effect will be terminated.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
changes the nroff escape character to that specified by the character argument. If no argument is provided, the default is a backslash.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the text for the footer on even numbered pages. The format is the same as for the footer command (see .fo).



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the text for the header on even numbered pages. The format is the same as for the footer command (see .fo).



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
designates the end of a macro definition.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes the input text to be rearranged or filled to obtain the maximum word count possible between the previously set left and right margins. No argument is expected.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes the output buffer to be flushed immediately.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies text to be used for a footer. The footer text contains three strings seperated by a delimiter character. The first non-blank character following the command is designated as the delimiter. The first text string is left justified to the current indentation value (specified by .in). The second string is centered between the current indentation value and the current right margin value (specified by .rm). The third string is right justified to the current right margin value. The absence of footer text will result in the footer being printed as one blank line. The presence of the page number character (set by .pc) in the footer text results in the current page number being inserted at that position. Multiple occurrances of the page number character are allowed.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
changes the current font. The choices are R (Times Roman), I (Times Italic), B (Times Bold), S (math special), and P used to request the previous font. P resets the next previous font to be the one just changed, amounting to a swap.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies text to be used for a header. The format is the same as for the footer (see .fo).



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
indents the left margin to the column value specified by the argument. The default left margin is set to zero.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes blanks to be inserted between words in a line of output in order to align or justify the right margin. The default is to justify.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
sets the current line length. The default is eighty.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
sets the line spacing to the value specified by the argument. The default is for single spacing.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the number of lines in the header margin. This is the space from the physical top of page to and including the header text. A value of zero causes the header to not be printed. A value of one causes the header to appear at the physical top of page. Larger argument values cause the appropriate number of blank lines to appear before the header is printed.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the number of blank lines to be printed between the header line and the first line of the processed text.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the number of blank lines to be printed between the last line of processed text and the footer line.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the number of lines in the footer margin. This command affects the footer the same way the .m1 command affects the header.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies a number of lines which should not be broken across a page boundary. If the number of lines remaining on a page is less than the value needed, then a new output page is started.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies that succeeding text should be printed without rearrangement, or with no fill. No argument is expected.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies that no attempt should be made to align or justify the right margin. No argument is expected.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes the value of a number register to be set or modified. A total of twenty-six number registers are available designated \na through \nz (either upper or lower case is allowed). When the sequence \nc is imbedded in the text, the current value of number register c replaces the sequence, thus, such things as paragraph numbering can be accomplished with relative ease.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the text for the footer on odd numbered pages. The format is the same as the footer command (see .fo).



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the text for the header on odd numbered pages. The format is the same as the footer command (see .fo).



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the page number character to be used in headers and footers. The occurrance of this character in the header or footer text results in the current page number being printed. The default for this character is the percent sign (%).



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies the page length or the number of lines per output page. The default is sixty-six.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies a page offset value. This allows the formatted text to be shifted to the right by the number of spaces specified. This feature may also be invoked by a switch on the command line.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
changes the page number of the current page and all subsequent pages to its argument. If no argument is given, the command is ignored.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes input to be retrieved from the file specified by the command's character string argument. The contents of the new file are inserted into the output stream until an EOF is detected. Processing of the original file is then resumed. Command nesting is allowed.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies a number of blank lines to be output before printing the next line of text.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
temporarily alters the indentation or left margin value for a single succeeding input line.



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
specifies text to be used for a page title. The format is the same as for the header (see .he).



$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
causes the next line(s) of text to be underlined. Unlike the .cu command, this command causes only alphanumerics to be underlined, skipping punctuation and white space. Underline and boldface are mutually exclusive.

 

ESCAPE SEQUENCES

Escape sequences are used to access special characters (such as Greek letters) which may be outside the normal printable ASCII character set. The are also used to toggle certain actions such as font selection.

The escape sequences include:

        \\          backslash character
        \"          beginning of comment
        \(xx        special character named xx
        \fc         font change (c = R,I,B,S,P)
        \nx         interpolate number register x

The special characters include:

        \(co        copyrite
        \(rg        registered
        \(tm        trademark
        \(12        1/2
        \(14        1/4
        \(p2        exponent 2
        \(p3        exponent 3
        \(pn        exponent n
        \(aa        acute
        \(ga        grave
        \(de        degree
        \(dg        dagger
        \(ct        cent
        \(bu        bullet
        \(pp        paragraph
        \(^g        ring bell
        \(ua        up arrow
        \(da        dn arrow
        \(->        rt arrow
        \(<-        lf arrow
        \(di        divide
        \(sr        sq root
        \(==        ==
        \(>=        >=
        \(<=        <=
        \(+-        +-
        \(~=        ~=
        \(ap        approx
        \(no        not
        \(mo        memeber
        \(ca        intersect
        \(cu        union
        \(*a        alpha
        \(*b        beta
        \(*g        gamma
        \(*d        delta
        \(*s        sigma
        \(*p        pi
        \(*m        mu

 

REQUEST SUMMARY

The following table summarizes the nroff requests:
Request Form    Initial  Default  Notes   Explanation
--------------  -------  -------  ------- ----------------------
Font and Character Size Control

.ps ±N          10pt     prev     E       point size
.ss N           12/36em  ignored  E       space-char size
.cs F N M       off      -        P       constant space mode
.bd F N         off      -        P       embolden font F
.bd S F N       off      -        P       embolden special font
.ft F           Roman    prev     E       change to font F
.fp N F         R,I,B,S  ignored  -       font F in position N
 
Page Control

.pl ±N          11in     11in     v       page length
.bp ±N          N=1      -        B,v     eject page
.pn ±N          N=1      ignored  -       next page number N
.po ±N          0        prev     v       page offset
.ne N           -        N=1V     D,v     need N vertical space
.mk R           none     intern   D       mark current V in R
.rt ±N          none     intern   D,v     return (up) to mark

Text Filling, Adjusting, and Centering

.br             -        -        B       break
.fi             fill     -        B,E     fill mode
.nf             fill     -        B,E     no fill or adjust
.ad c           adj,both adjust   E       adjust output, mode c
.na             adjust   -        E       no adjust
.ce N           off      N=1      B,E     center N lines

Vertical Spacing

.vs N           1/6in    prev     E,p     vert. baseline space
.ls N           N=1      prev     E       output N-1 Vs
.sp N           -        N=1V     B,v     space vertical
.sv N           -        N=1V     v       save vertical dist N
.os             -        -        D       output saved vert dist
.ns             space    -        D       no-space mode on
.rs             -        -        D       restore spacing

Line Length and Indenting

.ll ±N          6.5i     prev     E,m     line length
.in ±N          N=0      prev     B,E,m   indent
.ti ±N          -        ignored  B,E,m   temporary indent

Macros, Strings, Diversions, and Position Traps

.de xx yy       -        .yy=..   -       define macro xx
.am xx yy       -        .yy=..   -       append to macro xx
.ds xx str      -        ignored  -       define string xx
.as xx str      -        ignored  -       append to string xx
.rm xx          -        ignored  -       remove macro, string
.rn xx yy       -        ignored  -       rename macro, string
.di xx          -        end      D       divert output to xx
.da xx          -        end      D       divert and append to xx
.wh N xx        -        -        v       set location trap
.ch xx N        -        -        v       change trap location
.dt N xx        -        off      D,v     set diversion trap
.it N xx        -        off      E       set line count trap
.em xx          none     none     -       end macro is xx

Number Registers

.nr R ±N M               -        u       define and set num reg
.af R c         arabic   -        -       assign format to reg
.rr R           -        -        -       remove register

Tabs, Leaders, and Fields

.ta Nt ...      0.8      none     E,m     tab set
.tc c           none     none     E       tab repeat char
.lc c           .        none     E       leader repeat char
.fc a b         off      off      -       set field delim, pad

I/O Conventions and Character Translation

.ec c                           -       set escape char
.eo             on       -        -       turn off escape mech
.lg N           -        on       -       ligature mode if N>0
.ul N           off      N=1      E       underline N lines
.cu N           off      N=1      E       cont. underline
.uf F           Italic   Italic   -       underline font
.cc c           .        .        E       set control char
.c2 c           '        '        E       set nobreak control char
.tr abcd...     none     -        O       translate a-b, etc

Hyphenation

.nh             hyphen   -        E       no hyphenation
.hy N           hyphen   hyphen   E       hyphenate, N=mode
.hc c                         E       hyphanation char
.hw word1 ...   none     ignored  -       exception words

Three-part Titles

.tl 'l'c'r'              -        -       three-part title
.pc c           %        off      -       page number char
.lt ±N          6.5in    prev     E,m     length of title

Output Line Numbering

.nm ±N M S I             off      E       number mode
.nn N           -        N=1      E       do not number N lines

Conditional Acceptance of Input

.if c ...                -        -       if condition c true
.if !c ...               -        -       if condition c false
.if N ...                -        u       if expression N>0
.if !N ...               -        u       if expression N<=0
.if 's1's2' ...          -        -       if strings identical
.if !'s1's2' ...         -        -       if strings differ
.ie c ...                -        u       if portion of if/else
.ie !c ...               -        u       if portion of if/else
.ie N ...                -        u       if portion of if/else
.ie !N ...               -        u       if portion of if/else
.ie 's1's2' ...          -        u       if portion of if/else
.ie !'s1's2' ...         -        u       if portion of if/else
.el ...                  -        u       else portion of if/else

Environment Switching

.ev N           N=0      prev     -       environment switched
 
Insertions From the Standard Input

.rd prompt      -        BEL      -       read insertion
.ex             -        -        -       exit nroff

Input/Output File Switching

.so filename             -        -       switch source file
.nx filename             EOF      -       next file
.pi program              -        -       pipe output to program

Miscellaneous

.mc c N         -        off      E,m     set margin char
.tm string      -        newline  -       terminal message
.ig yy          -        .yy=..   -       ignore till call to yy
.pm t           -        all      -       print macro names
.fl             -        -        B       flush output buffer

Notes

B       causes a break
D       mode or parameters associated with current diversion level
E       relevant parameters are a part of the current environment
O       must stay in effect until logical output
P       mode must be still or again in effect at time of physical output
v,p,m,u default scale indicators

 

AUTHOR

Adapted for atariST/TOS by Bill Rosenkranz 11/89

net:    rosenkra@hall.cray.com
CIS:    71460,17
GENIE:  W.ROSENKRANZ

Original author:

Stephen L. Browning
5723 North Parker Avenue
Indianapolis, Indiana 46220

History:

- Originally written in BDS C
- Adapted for standard C by W. N. Paul
- Heavily hacked up to conform to "real" nroff by Bill Rosenkranz


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ENVIRONMENT
FILES
COMMANDS
ESCAPE SEQUENCES
REQUEST SUMMARY
AUTHOR

This document was created by man2html, using the manual pages.
Time: 22:01:41 GMT, August 02, 2022